<%--
  Created by IntelliJ IDEA.
  User: yanxiu
  Date: 2017/12/3
  Time: 16:01
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>wms</title>
    <link href="/static/plugins/bootstrap/css/bootstrap.css" rel="stylesheet"/>
    <link href="/static/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">

    <style>
        .myLabel {
            font-size: larger;
        }

        .box-padding-15 {
            padding: 15px;
        }

        .searchButton {
            background-color: #009688;
            color: white;
            font-family: Aparajita;
            font-size: larger;
            font-weight: bolder;
            border-radius: 4px;
            letter-spacing: 5px;
        }

        #container {
            position: relative;
            left: 270px;
        }

        .layui-col-lg5 input {
            border: none;
        }

        .layui-col-lg5 td {
            border: solid 1px #cccccc;
            width: 378px;
            height: 80px;
            cellspacing: "0";
            cellpadding: "0";
        }

        .table1 {
            border-bottom: solid 1px #cccccc;
        }

        .layui-side{
           height: 125px;
            background: wheat;
        }
    </style>
</head>

<body>


<%--<div class="layui-side ">--%>
    <%--<div class="layui-side-scroll" >--%>
        <%--<!-- 左侧导航区域（可配合layui已有的垂直导航） -->--%>
        <%--<ul class="layui-nav layui-nav-tree"  lay-filter="nav-tree">--%>
            <%--<li class="layui-nav-item">--%>
                <%--<a class="" href="javascript:;">出货方式</a>--%>
                <%--<dl class="layui-nav-child">--%>
                    <%--<dd data-uri="/return/shouchu"><a href="javascript:;" >手动出货</a></dd>--%>
                    <%--<dd data-uri="/return/zichu" ><a href="javascript:;">自动出货</a></dd>--%>
                <%--</dl>--%>
            <%--</li>--%>
        <%--</ul>--%>
    <%--</div>--%>
<%--</div>--%>
<div class="box-form">
    <form class="layui-form " action="/return/shouchu" method="post"  id="formi">
        <div class="layui-form-item">
            <div class="layui-input-block">

                <button class="layui-btn" lay-submit lay-filter="formSubmit" id="btn" >手动出货</button>

            </div>
        </div>
    </form>
</div>

<div class="box-form">
    <form class="layui-form " action="/return/zichu" method="post"  id="formid">
<div class="layui-form-item">
    <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="formSubmit" id="b">自动出货</button>

    </div>
</div>
    </form>
</div>





<script src="/static/plugins/jquery-3.2.1.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.js"></script>
<script src="/static/plugins/bootstrap-table/bootstrap-table.js"></script>
<script src="/static/plugins/bootstrap-table/bootstrap-table-zh-CN.js"></script>
<script src="/static/plugins/layui/layui.js"></script>

<script>
    layui.use(['element', 'layer', 'form', 'laydate', 'table'], function () {
        var layer = layui.layer;
        //定义表格
        var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
        var form = layui.form;
        var laydate = layui.laydate;
        var table = layui.table;


        //监听提交
        form.on('submit(formDemo)', function (data) {
            var fields = data.field;
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        //监听还车门店选择框
        form.on('select(etrentDept)',function () { debugger;
            var $etrentDept= $('select[name=etrentDept]');
            var deptId = $etrentDept.val();
            var deptSpecific = $etrentDept.data(deptId);
            $('input[name=etrentDeptSpecific]').val(deptSpecific);
        })

        //监听订单号输入框
        var $orderId = $('input[name=orderId]');
        var $readybtTime = $('input[name=readybtTime]');
        var $realbtTime = $('input[name=realbtTime]');
        var $btrentDept = $('input[name=btrentDept]');
        var $rentDays = $('input[name=rentDays]');
        var $btrentDeptSpecific = $('input[name=btrentDeptSpecific]');
        var $car = $('.car');
        $orderId.bind('change', function (data) {
            var orderId = $orderId.val();
            $.ajax({
                url:"/return/orderAjax",
                type:'get',
                data:{orderId:orderId},
                dataType:'json',
                success:function (result) {
                    var order = result.data;
                    if(null!=order){
                        var realbt= order.realbtTime;  //获取实际取车时间戳
                        var guessbt = order.readybtTime;  //获取预计取车时间戳
                        var realbtTime = getMyDate(realbt);  //转换
                        var readybtTime = getMyDate(guessbt); //转换
                        $realbtTime.val(realbtTime); //预计取车时间
                        $readybtTime.val(readybtTime); //预计还车时间
                        $rentDays.val(order.rentDays); //租期
                        var carInfo =order.carBrand+' / '+order.carColor+' / '+order.carBrandType+'     '+ order.isAutoStr+' / '+order.engineSize+' / '+order.seatNum+'座';  //车辆信息
                        $car.val(carInfo); //车辆信息
                        var deptInfo=order.inCity+' '+order.deptName;
                        $btrentDept.val(deptInfo);//获取预计取车门店
                        var deptSpecific=order.inCity+order.address
                        $btrentDeptSpecific.val(deptSpecific) //取车门店详情
                    }
                    if(result.code==1){
                        layer.msg(result.message, {time: 2000, icon: 1});
                    }else{
                        layer.msg(result.message, {time: 2000, icon: 2});
                    }
                },
                error:function () {
                    layer.msg("服务器忙，稍后再试")
                }
            });
        });


    });

    //时间戳转日期
    function getMyDate(str){
        var oDate = new Date(str),
            oYear = oDate.getFullYear(),
            oMonth = oDate.getMonth()+1,
            oDay = oDate.getDate(),
            oHour = oDate.getHours(),
            oMin = oDate.getMinutes(),
            oSen = oDate.getSeconds(),
            oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin) +':'+getzf(oSen);//最后拼接时间
        return oTime;
    };
    //补0操作
    function getzf(num){
        if(parseInt(num) < 10 ){
            num = '0'+num;
        }
        return num;
    }
</script>

</body>
</html>
